<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>示例7</title>
    <style>
        .red{
            color:red;
        }
    </style>
    <script src="jquery.js"></script>
    <script>
        function show(){
            // $("h2").attr("class","red")
            $("h2").attr({
                class:"red",
                title:"你好啊"
            })
        }

        function unshow(){
            // $("h2").removeAttr("class")
            $("h2").removeAttr("class").removeAttr("title")
        }
    </script>
</head>
<body>
    <button onclick="show()">添加属性</button>
    <button onclick="unshow()">删除属性</button>
    <h2>accp</h2>
</body>
</html>